package cn.snowheart.ssm.util;

import org.springframework.context.ApplicationContext;

public class SpringContextHolder {
	private static ApplicationContext context;

	public static void setContext(ApplicationContext context) {
		SpringContextHolder.context = context;
	}

	public static Object getBean(final String name) {
		return context != null ? context.getBean(name) : null;
	}

	public static <T> T getBean(final Class<T> clazz) {
		return context != null ? context.getBean(clazz) : null;
	}
}
